
<?php

class Common_msg_model extends MY_CI_Model
{

    /**
     * @access public
     */
    public function __construct()
    {
    	$this->table 		= 'common_msg';
    	$this->primary_id 	= 'id';
    	$this->primary_name	= 'order_sn';

        parent::__construct ();

    }
    
    	/**
	 * 检查字段的合法性，过滤非法字段
	 * @param unknown $datas
	 * @return unknown
	 */
	public function check_post_form_datas($datas)
	{	   
		$access_statement = $this->db->list_fields($this->table);
		$exclude_fields = array($this->primary_id);
		if(!empty($exclude_fields)){
			$access_statement = array_diff($access_statement ,$exclude_fields);
		}
		foreach($datas as $key => $val){
			if(!in_array($key, $access_statement)){
				unset($datas[$key]);
			}
			if(is_array($val)){
				$datas[$key] = implode(',', $val);
			}
		}
		return $datas;
	}
    
        
}

?>